import time

def Sortirovka(mas):
    f1 = True
    while f1:
        f1 = False
        for i in range(len(mas) - 1):
            if mas[i] > mas[i + 1]:
                mas[i], mas[i + 1] = mas[i + 1], mas[i]
                f1 = True

def read2list(filename):
    file1 = open(filename, 'r')
    t_data = file1.readlines()
    return t_data

a1 = read2list("m1_sorted.txt")
a2 = read2list("m2_reverse.txt")
a3 = read2list("m3_shuffle.txt")

time_st = time.time()
Sortirovka(m1)
time_f = time.time()
print("m1_sorted",round((time_f-time_st)*1000),"milliseconds")

time_st = time.time()
Sortirovka(m2)
time_f = time.time()
print("m2_reverse",round((time_f-time_st)*1000),"milliseconds")

time_st = time.time()
Sortirovka(m3)
time_f = time.time()
print("m3_shuffle",round((time_f-time_st)*1000),"milliseconds")
